function quickSortReform2(arr,left,right){
    if (left >= right){
        return arr;
    }
    let value = arr[left];
    let array = [];
    let i = left;
    let j = right;
    while(i < j){
        while(i < j && arr[j] >= value){
            j--;
        }
        while(i < j && arr[i] <= value){
            i++;
        }
        if (i < j){
            let temp = arr[i];
            arr[i] = arr[j];
            arr[j] = temp;
        }
    }
    arr[left] = arr[i];
    arr[i] = value;
    array = quickSortReform2(arr,left,i - 1);
    array = quickSortReform2(array,i + 1,right);
    return array;
}

let arr = quickSortReform2([23,123,123,234,34,54,65,76,3,234,34,545],0,9);
console.log(arr)

function quickSort(arr,left,right){
    if (left >= right){
        return arr;
    }
    let num = arr[left];
    let i = left;
    let j = right;
    while(i < j){
        while(i <= j && arr[i] <= num){
            i++;
        }
        while(i <= j && arr[j] >= num){
            j--;
        }
        if (i < j){
            let temp;
            temp = arr[i];
            arr[i] = arr[j];
            arr[j] = temp;
        }
    }
    arr[left] = arr[i - 1];
    arr[i - 1] = num;
    let index = i - 1;
    arr = quickSort(arr,left,index - 1);
    arr = quickSort(arr,index + 1,right);
    return arr;
}

let arr2 = quickSort([1,232,2,3,4,67,45,34,78,45],0,9);

console.log(arr2);